<template>
    <div class="main">
        <van-image radius="5" lazy-load fit="cover" class="img"  height="100px" width="80px" :src="imgs" alt=""/>

        <!-- 主要内容区域文字部分 -->
        <div class="int" @click="$router.push(`/xiangqing/${id}/${type}`)">
            <div>
                <b>{{ name }}</b>
            </div>
            <div>
                <span>主演：{{ actor }}</span>
            </div>
            <div>评分：{{ score }}</div>
        </div>


        <!-- 主要内容区域按钮 -->
        <div class="btn">
            <!-- 点赞按钮 -->
            <van-icon  class="btn1" @click="clicking" :badge="dz_count" size="1.5rem" name="thumb-circle" color="#1989fa"/>
            <!-- 收藏按钮 -->
            <van-icon @click="shoucang" color="#1989fa" class="btn2"  size="1.5rem" name="like-o" />
        </div>
    </div>
</template>

<script>
import { number } from 'echarts';

export default {
    props:{
        imgs: {
        type: String,    // name的类型为String, 不传String报错
        required: true   // name必填, 不传name参数就报错
      },
      name: {
        type: String,    // avatar的类型为String, 不传String报错
        required: true   // avatar必填, 不传avatar参数就报错
      },
      actor: {
        type: String,    // avatar的类型为String, 不传String报错
        required: true   // avatar必填, 不传avatar参数就报错
      },
      score: {
        type: String,    // avatar的类型为String, 不传String报错
        required: true   // avatar必填, 不传avatar参数就报错
      },
      dz_count: {
        // type: String,    // avatar的类型为String, 不传String报错
        required: true   // avatar必填, 不传avatar参数就报错
      },
      id:{
        type:Number,
        require:true
      },
      type:{
        type:String,
        require:true
      },
    },

    methods: {
      clicking () { // 只要点了叉子, 就会触发该事件
        // 此处直接抛出自定义事件, 交给父组件来做后续业务
        this.$emit('dz', {name:'zs', age:35, id:11})
      },
      shoucang(type,id){
        this.$emit('sc',{type:this.type,id:this.id})
        // console.log(this.type,this.id);
      },
      
     
    },
}
</script>

<style lang="scss" scoped>

.main{
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 20px;
    background-color: #f7f7f7;
    box-shadow: 0 0 10px 2px #bfbcbc;


    .img{
      border-radius: 5px;
    }

    .int{
        width: 100%;
        padding-left: 8px;
        flex: 1;
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
        // display: flex;
        // justify-content: space-around;
        span{
            white-space:nowrap;
            overflow:hidden;
            text-overflow: ellipsis;
            display: inline-block;
            width: 150px;
        
        }
    }
    .btn{
       padding-right: 5px; 
       margin-top: 50px;
       
        .btn1{
            margin-right: 8px;
            &:active{
              opacity: 0.8;
            }
        }
        .btn2:active{
          opacity: 0.8;
        }
    }
}

</style>